<?php
class ModelCategoryProductbrand extends Model 
{
	public function getList()
	{
		$query = $this->db->query("Select * from `product_brand`");
		return $query->rows;
	}
	
	public function getItem($brandid)
	{
		$query = $this->db->query("Select * from `product_brand` where brandid = '".$brandid."'");
		return $query->row;
	}
	
	public function insert($data)
	{
		$brandid=$this->db->escape(@$data['brandid']);
		$brandname=$this->db->escape(@$data['brandname']);
		
		$field=array(
						'brandname'
					);
		$value=array(
						$brandname
					);
		$this->db->insertData("product_brand",$field,$value);
	}
	
	public function update($data)
	{
		$brandid=$this->db->escape(@$data['brandid']);
		$brandname=$this->db->escape(@$data['brandname']);
		
		$field=array(
						'brandname'
					);
		$value=array(
						$brandname
					);
					
		$where="brandid = '".$brandid."'";
		$this->db->updateData("product_brand",$field,$value,$where);
	}	
			
	public function delete($brandid)
	{
		$brandid=$this->db->escape(@$brandid);
		$where="brandid = '".$brandid."'";
		$this->db->deleteData('product_brand',$where);
	}
	
	public function deletes($data)
	{
		foreach($data as $brandid)
		{
			$this->delete($brandid);
		}		
	}
	
}

?>